import request from '@/utils/request'

// 创建拣货任务
export function createPickTask(data) {
  return request({
    url: '/hs/pick-task/create',
    method: 'post',
    data: data
  })
}

// 更新拣货任务
export function updatePickTask(data) {
  return request({
    url: '/hs/pick-task/update',
    method: 'put',
    data: data
  })
}

// 删除拣货任务
export function deletePickTask(id) {
  return request({
    url: '/hs/pick-task/delete?id=' + id,
    method: 'delete'
  })
}

// 获得拣货任务
export function getPickTask(id) {
  return request({
    url: '/hs/pick-task/get?id=' + id,
    method: 'get'
  })
}

// 获得拣货任务分页
export function getPickTaskPage(params) {
  return request({
    url: '/hs/pick-task/page',
    method: 'get',
    params
  })
}
// 导出拣货任务 Excel
export function exportPickTaskExcel(params) {
  return request({
    url: '/hs/pick-task/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获得拣货中待拣货list
export function getStartPick(pickTaskId) {
  return request({
    url: '/hs/pick-task/start-pick?pickTaskId=' + pickTaskId,
    method: 'get',
  })
}

// 更新拣货任务状态为已完成
export function complete(pickTaskId) {
  return request({
    url: '/hs/pick-task/complete?pickTaskId=' + pickTaskId,
    method: 'post'
  })
}
